#pragma once
#include "pch.h"
#include "Core.h"
#include "GLFWTimer.h"
#include "InputSystem.h"

struct OglApp
{
    GLFWwindow* window = nullptr;

    struct State
    {
        int mClientWidth;
        int mClientHeight;
        int mClientPosX;
        int mClientPosY;
        bool mFullScreen;
        
    };
    GLFWTimer m_Timer;
    State state;
    InputSystem inputSystem;

    OglApp();

    const float GetAspect();
    void SetFullScreen();
    void SetWindowMode();
    void CloseWindow();
    bool InitOpengl(const GLFWConfig& config);
    virtual bool Create(const GLFWConfig& config);
    virtual void Execute();
    virtual void OnTick();
    virtual void OnAfterUpdate();
    virtual void OnDestroy();
    virtual void OnFrameRender();
    virtual void OnClose();

public:
    // callback
    virtual void OnFrameBufferSize(int w, int h);
    virtual void OnFocus(int e);
    virtual void OnMonitor(int e);

    // Callback
    virtual void OnCursorPos(double x, double y);
    virtual void OnMouse(int key, int action, int mode);
    virtual void OnKeyCallback(int, int, int, int);
    virtual void OnJoystick(int joy, int event);
    virtual void OnScroll(double x, double y);

    virtual void OnWindowIconify(int ev);
    virtual void OnRefresh();
    virtual void OnWindowPos(int x, int y);

};